<li class="property">
  <div>
    <%= property.label :presentation, :style => "float: left;" %>
    <%= property.autocomplete_field :presentation, autocomplete_property_presentation_admin_properties_path, :class => "property_presentation", :maxlength => 35, :node_id => property.object.id %>

    <%= property.hidden_field :position, :class => "property_position" %>

    <span style="float: right;"><%= link_to_remove_fields("Smazat skupinu", property, "property") %></span>
  </div>

  <ol class="property_attributes" id="<%= "#{dom_id(property.object, :product_property_attribute_new)}" %>">
    <% unless property.object.property_attributes.blank? %>
        <% property.object.property_attributes.roots.each do |pa| %>
          <%= property.fields_for :property_attributes, pa do |property_attribute| %>
            <%= render :partial => "property_attributes", :locals => {:property_attribute => property_attribute, :property => property} %>
          <% end %>
        <% end %>
    <% end %>
  </ol>

  <%= spinner "#{dom_id(property.object, :property_attribute)}" %>
  <%= link_to 'Přidat vlastnost', new_property_attribute_admin_property_patterns_path(:property_id => property.object.id), :class => "new_button", :id => "#{dom_id(property.object, :property_attribute_button)}", :remote => true, :style => "width: 140px;" %>
</li>

<script type="text/javascript">
  jQuery(function($) {
    var toggleSpinner = function() {$("#<%= "#{dom_id(property.object, :property_attribute)}" %>").toggle()};

    $("#<%= "#{dom_id(property.object, :property_attribute_button)}" %>")
      .bind("ajax:beforeSend", toggleSpinner)
      .bind("ajax:complete", toggleSpinner);
  });
</script>